{% extends "base.html" %}

{% block title %}{{ title }} - 滩羊主要地方流行性疫病病原区系系统{% endblock %}

{% block content %}
<div class="container-fluid">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">{{ title }}</h5>
                    <form method="POST">
                        {{ form.hidden_tag() }}
                        <div class="mb-3">
                            {{ form.username.label(class="form-label") }}
                            {{ form.username(class="form-control") }}
                            {% for error in form.username.errors %}
                            <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        </div>
                        <div class="mb-3">
                            {{ form.email.label(class="form-label") }}
                            {{ form.email(class="form-control") }}
                            {% for error in form.email.errors %}
                            <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        </div>
                        <div class="mb-3">
                            {{ form.password.label(class="form-label") }}
                            {{ form.password(class="form-control") }}
                            {% if request.endpoint == 'user.edit' %}
                            <div class="form-text">留空表示不修改密码</div>
                            {% endif %}
                            {% for error in form.password.errors %}
                            <div class="text-danger">{{ error }}</div>
                            {% endfor %}
                        </div>
                        <div class="mb-3">
                            <div class="form-check">
                                {{ form.is_admin(class="form-check-input") }}
                                {{ form.is_admin.label(class="form-check-label") }}
                            </div>
                        </div>
                        <div class="d-grid gap-2">
                            {{ form.submit(class="btn btn-primary") }}
                            <a href="{{ url_for('user.list') }}" class="btn btn-secondary">返回</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 